<!DOCTYPE html>
<html lang="en"  xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

  <head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Pet Homepage</title>

    <link th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/home.css}" rel="stylesheet">

  </head>

  <body>

    <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
      <div class="container">
        <a class="navbar-brand" href="#">Pet Platform</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarResponsive">
          <ul class="navbar-nav ml-auto">
            <li class="nav-item active">
              <a class="nav-link" href="/index">Home
                <span class="sr-only">(current)</span>
              </a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/api/orders">Orders</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/activities">Activities</a>
            </li>

            <li class="nav-item" th:if="${#strings.isEmpty(session.email)}">
              <a class="nav-link" href="/login">Signin</a>
            </li>

            <li class="nav-item dropdown" th:if="${not #strings.isEmpty(session.email)}">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span th:text="${session.email}">...</span>
              </a>
              <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                <a class="dropdown-item" href="/logout">Logout</a>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </nav>

    <div class="container">

      <div class="row">

        <div class="col-lg-3">

          <h1 th:text="${shop.name}" class="my-4"/>
          <h5 th:text="${shop.address}" class="my-4"/>
          <img style="width:200px" th:src="@{'/uploadfile/'+${shop.mainpic}}" />
          <img style="margin-top:10px;width:200px" th:src="@{/img/2.png}" />

        </div>
        <!-- /.col-lg-3 -->

        <div class="col-lg-9">

          <div class="card mt-4">
            <img class="card-img-top img-fluid" th:src="@{'/uploadfile/'+${good.picture}}" alt="">
            <div class="card-body">
              <h3 class="card-title" th:text="${good.name}"></h3>
              <h4 th:text="${good.price}"></h4>
              <p class="card-text" th:text="${good.description}"></p>
              <div th:switch="${good.star}">
              <span th:case="'5'" class="text-warning">&#9733; &#9733; &#9733; &#9733; &#9733;</span>
              <span th:case="'4'" class="text-warning">&#9733; &#9733; &#9733; &#9733; &#9734;</span>
              <span th:case="'3'" class="text-warning">&#9733; &#9733; &#9733; &#9734; &#9734;</span>
              <span th:case="'2'" class="text-warning">&#9733; &#9733; &#9734; &#9734; &#9734;</span>
              <span th:case="'1'" class="text-warning">&#9733; &#9734; &#9734; &#9734; &#9734;</span>
              <span th:case="'0'" class="text-warning">&#9734; &#9734; &#9734; &#9734; &#9734;</span>

              <span th:text="@{${good.star}+' stars'}"></span>
              </div>
            </div>
          </div>
          <!-- /.card -->

          <div class="card card-outline-secondary my-4">
            <div class="card-header">
              Product Reviews
            </div>
            <div class="card-body">
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis et enim aperiam inventore, similique necessitatibus neque non! Doloribus, modi sapiente laboriosam aperiam fugiat laborum. Sequi mollitia, necessitatibus quae sint natus.</p>
              <small class="text-muted">Posted by Anonymous on 3/1/17</small>
              <hr>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis et enim aperiam inventore, similique necessitatibus neque non! Doloribus, modi sapiente laboriosam aperiam fugiat laborum. Sequi mollitia, necessitatibus quae sint natus.</p>
              <small class="text-muted">Posted by Anonymous on 3/1/17</small>
              <hr>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis et enim aperiam inventore, similique necessitatibus neque non! Doloribus, modi sapiente laboriosam aperiam fugiat laborum. Sequi mollitia, necessitatibus quae sint natus.</p>
              <small class="text-muted">Posted by Anonymous on 3/1/17</small>
              <hr>
              <a th:href="@{'/api/buyone?goodsId='+${good.id}+'&shopId='+${shop.id} }" class="btn btn-success">Buy One</a>
            </div>
          </div>
          <!-- /.card -->

        </div>
        <!-- /.col-lg-9 -->

      </div>
      <!-- /.row -->

    </div>
    <!-- /.container -->

    <!-- Footer -->
    <footer class="py-5 bg-dark">
      <div class="container">
        <p class="m-0 text-center text-white">Copyright &copy; Pet Website 2018</p>
      </div>
      <!-- /.container -->
    </footer>

    <!-- Bootstrap core JavaScript -->
    <script th:src="@{/jquery/jquery.min.js}"></script>
    <script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>

  </body>

</html>
